home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / DEV / I-Z / ResExpress 1.0.1.sea / ResExpress 1.0.1 ƒ / ResX DevKit / Think C / snd player.c < prev    next >
C/C++ Source or Header  |  1991-07-14  |  1KB  |  60 lines

  1. /* ************************************************************** *\
  2. To compile in Think C:
  3.    1) Set Project Type to 'Code Resource' 
  4.    2) Set the File TYPE to 'RXXT' and File Creator to 'ResX'
  5.    3) Set the Resource TYPE to 'RXVW' 
  6.    4) Set the Resource NAME to 'snd '. 
  7.    5) Add this file, MacTraps, and ResX Utils.lib to the project 
  8.    6) Compile the code resource. 
  9.    7) Install it in ResX via the 'Externals->Install' menu. 
  10. \* ************************************************************** */
  11.  
  12.  
  13. #include "ResX Utils.h"
  14. #include "Duplicate.h"
  15. #include "MacTypes.h"
  16. #include "QuickDraw.h"
  17. #include "DeviceMgr.h"
  18. #include "EventMgr.h"
  19. #include "FileMgr.h"
  20. #include "MemoryMgr.h"
  21. #include "ResourceMgr.h"
  22. #include "WindowMgr.h"
  23. #include "SetUpA4.h"
  24. #include "String.h"
  25. #include "SoundMgr.h"
  26.  
  27. #define      TRUE   1
  28. #define      FALSE  0
  29. #define      NIL    0
  30.  
  31.  
  32. /* Start of code resource */
  33. pascal void main(TheHandle)
  34. Handle TheHandle;
  35. {
  36. SignedByte    HState;
  37. SndChannelPtr     sndChan;
  38. OSErr    sndErr;
  39.  
  40.     RememberA0();
  41.     SetUpA4();
  42.     HState = HGetState(TheHandle);          
  43.  
  44.     LoadResource(TheHandle);
  45.     HLock(TheHandle);
  46.  
  47.     sndChan = NIL;    
  48.     if ( ResError() == 0 && TheHandle != NIL) {
  49.         sndErr = SndPlay(sndChan,TheHandle,TRUE);
  50.         }
  51.     else
  52.         OKAlert("\pCould not load the resource.");
  53.     
  54.     HUnlock(TheHandle);
  55.     HSetState(TheHandle, HState);          
  56.     RestoreA4()
  57.     
  58.     /* Do NOT release the resource.  ResX will do it if necessary. */
  59. }
  60. /* End of code resource */